package pt.iscte.pcd.project.client;

import java.io.IOException;

import pt.iscte.pcd.project.order.Order;

public class DealWithServerSender extends Thread{
	private DealWithServer  dealServer;

	public DealWithServerSender(DealWithServer dealServer) {
		this.setDealServer(dealServer);
	}
	
	@Override
	public void run() {
		while(! isInterrupted()){
				Order order;
				try {
				
					order = dealServer.retiraPedidosDaListaAEnviar();
					dealServer.getOut().reset();
					dealServer.getOut().flush();
					dealServer.getOut().writeObject(order);
					System.out.println("ENVIEI MSG");
				} catch (InterruptedException | IOException e) {
					e.printStackTrace();
				}
				
			
		}

	}


	public DealWithServer getDealServer() {
		return dealServer;
	}


	public void setDealServer(DealWithServer dealServer) {
		this.dealServer = dealServer;
	}



}
